package com.base.cn.platform.os.service.course.open;

import com.base.cn.platform.os.entity.course.open.CourseOpen;
import com.base.cn.platform.os.service.FeignAuthConfig;
import com.base.cn.platform.os.service.course.CourseBaseService;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * 免费直播的Feign接口
 *
 * @author s.li
 * @create 2018-05-03-16:34
 */
@FeignClient(name = CourseBaseService.appName,configuration = FeignAuthConfig.class)
public interface CourseOpenService extends CourseBaseService {

    /**
     * 查询多条件免费直播数量
     * @param condition 查询条件对象
     * @return 返回数量
     */
    @RequestMapping(contextPath + "/getCourseOpenCount")
    BigDecimal getCourseOpenCount(@RequestBody Map<String, Object> condition);

    /**
     * 保存免费直播课程
     * @param courseOpen 免费直播课程对象
     * @return CourseOpen
     */
    @RequestMapping(contextPath + "/saveCourseOpen")
    Map<String,Object> saveCourseOpen(@RequestBody Map<String, Object> courseOpen);

    /**
     * 保存免费直播描述信息
     * @param courseOpen 免费直播数据对
     * @return CourseOpen
     */
    @RequestMapping(contextPath + "/saveCourseOpenInfo")
    Map<String,Object> saveCourseOpenInfo(@RequestBody Map<String, Object> courseOpen);

    /**
     * 修改免费直播状态
     * @param ids 免费直播ID
     * @param status 1：正常 2：冻结 3：删除
     */
    @RequestMapping(contextPath + "/updateCourseOpenStatus")
    Map<String,Object> updateCourseOpenStatus(@RequestParam("ids") String ids,
                                              @RequestParam("status") int status);

    /**
     * 通过ID，查询免费直播数据对象
     * @param id 免费直播ID
     * @param setSubjectData 是否设置专业
     * @param setTeacherData 是否设置讲师
     * @param setCreateUserData 是否设置创建人数据
     * @return CourseOpen
     */
    @RequestMapping(contextPath + "/findCourseOpenById")
    Map<String,Object> findCourseOpenById(@RequestParam("id") BigDecimal id,
                                          @RequestParam("setSubjectData") boolean setSubjectData,
                                          @RequestParam("setTeacherData") boolean setTeacherData,
                                          @RequestParam("setCreateUserData") boolean setCreateUserData);

    /**
     * 通过ID串，查询免费直播数据Map
     * @param ids 免费直播ID串
     * @param setSubjectData 是否设置专业
     * @param setTeacherData 是否设置讲师
     * @param setCreateUserData 是否设置创建人数据
     * @return List<CourseOpen>
     */
    @RequestMapping(contextPath + "/findCourseOpenMapByIds")
    Map<BigDecimal,Map<String,Object>> findCourseOpenMapByIds(@RequestParam("ids") String ids,
                                                              @RequestParam("setSubjectData") boolean setSubjectData,
                                                              @RequestParam("setTeacherData") boolean setTeacherData,
                                                              @RequestParam("setCreateUserData") boolean setCreateUserData);

    /**
     * 通过ID串，查询免费直播数据列表
     * @param ids 免费直播ID串
     * @param setSubjectData 是否设置专业
     * @param setTeacherData 是否设置讲师
     * @param setCreateUserData 是否设置创建人数据
     * @return List<CourseOpen>
     */
    @RequestMapping(contextPath + "/findCourseOpenListByIds")
    List<Map<String,Object>> findCourseOpenListByIds(@RequestParam("ids") String ids,
                                                     @RequestParam("setSubjectData") boolean setSubjectData,
                                                     @RequestParam("setTeacherData") boolean setTeacherData,
                                                     @RequestParam("setCreateUserData") boolean setCreateUserData);

    /**
     * 多条件查询免费直播数据列表
     * @param condition 查询条件对象
     * @param setSubjectData 是否设置专业
     * @param setTeacherData 是否设置讲师
     * @param setCreateUserData 是否设置创建人数据
     * @param setCreateUserData 是否设置直播预约数据
     * @return List<CourseOpen>
     */
    @RequestMapping(contextPath + "/findCourseOpenList")
    List<Map<String,Object>> findCourseOpenList(@RequestBody Map<String, Object> condition,
                                                @RequestParam("setSubjectData") boolean setSubjectData,
                                                @RequestParam("setTeacherData") boolean setTeacherData,
                                                @RequestParam("setCreateUserData") boolean setCreateUserData,
                                                @RequestParam("setReservationData") boolean setReservationData);

    /**
     * 分页查询免费直播数据列表
     * @param condition 查询条件对象
     * @param currentPage 页码
     * @param pageSize 显示数量
     * @param setSubjectData 是否设置专业
     * @param setTeacherData 是否设置讲师
     * @param setCreateUserData 是否设置创建人数据
     * @param setCreateUserData 是否设置直播预约数据
     * @return PageInfo<CourseOpen>
     */
    @RequestMapping(contextPath + "/findCourseOpenPage")
    Map<String,Object> findCourseOpenPage(@RequestBody Map<String, Object> condition,
                                          @RequestParam(value = "currentPage", required = false, defaultValue = "1") int currentPage,
                                          @RequestParam(value = "pageSize", required = false, defaultValue = "14") Integer pageSize,
                                          @RequestParam("setSubjectData") boolean setSubjectData,
                                          @RequestParam("setTeacherData") boolean setTeacherData,
                                          @RequestParam("setCreateUserData") boolean setCreateUserData,
                                          @RequestParam("setReservationData") boolean setReservationData);


    /**
     * 后台管理员开始直播
     * @param id 免费直播ID
     * @param sysUserId 登录用户ID
     * @param auth 认证当前用户与直播讲师一致
     * @return  Map<String,Object>
     */
    @RequestMapping(contextPath + "/startAdminCourseOpenLive")
    Map<String,Object> startAdminCourseOpenLive(@RequestParam("id") BigDecimal id,
                                                @RequestParam("sysUserId") BigDecimal sysUserId,
                                                @RequestParam(value = "auth", required = false, defaultValue = "false") boolean auth);

    /**
     * 获取当前正在直播的免费直播
     * @return
     */
    @RequestMapping(contextPath + "/findNowLiveCourseOpen")
    Map<String,Object> findNowLiveCourseOpen();

    /**
     * 播放接口
     * @param id 免费直播ID
     * @param userId 用户ID
     * @param form 来源
     * @return Map<String,Object>
     */
    @RequestMapping(contextPath + "/playOpenLive")
    Map<String,Object> playOpenLive(@RequestParam("id") BigDecimal id,
                                    @RequestParam("userId") BigDecimal userId,
                                    @RequestParam("form") String form);

    /**
     * 复制直播链接
     * @param id 课程ID
     * @return 链接
     */
    @RequestMapping(contextPath + "/getCopyLiveUrl")
    String getCopyLiveUrl(@RequestParam("id") BigDecimal id);

    /**
     * 获取主播放的链接
     * @param id 课程ID
     * @return 直播链接
     */
    @RequestMapping(contextPath + "/getAdminCopyLiveUrl")
    String getAdminCopyLiveUrl(@RequestParam("id") BigDecimal id);

    /**
     * 查询免费直播总数量数据
     * @return CourseOpenSumCount
     */
    @RequestMapping(contextPath + "/queryCourseOpenSumCount")
    Map<String,Integer> queryCourseOpenSumCount();

    /**
     * 查询免费直播
     * @param whereSql
     * @return
     */
    @RequestMapping(contextPath + "/findCourseOpenBySql")
    CourseOpen findCourseOpenBySql(@RequestParam("whereSql") String whereSql);
}
